package com.ecloud.gardensterminal.controller;

import com.ecloud.gardensterminal.common.JsonResult;
import com.ecloud.gardensterminal.controller.dto.GardensDeviceSelectDto;
import com.ecloud.gardensterminal.domain.GardensSleet;
import com.ecloud.gardensterminal.server.GardensSleetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Squbi
 */
@RestController
public class GardensSleetController {
    @Autowired
    private GardensSleetService sleetService;

    @GetMapping("/sleet/newly")
    public JsonResult getSleetNewly() {
        List<GardensSleet> result = sleetService.selectNewly();
        return JsonResult.success(result);
    }

    @PostMapping("/sleet/list")
    public JsonResult getSleetList(@RequestBody GardensDeviceSelectDto dto) {
        List<GardensSleet> result = sleetService.selectList(dto);
        return JsonResult.success(result);
    }
}
